<script type="text/javascript">
function getText() {  
	//The form data is sent to the given URL using a POST method, 
  	//rather than a GET by using the dojo.xhrPost function.
  	dojo.xhrPost({
    	url: "<?= $this->baseUrl() ?>/dojotest/add",
    	load: function(response){
      		dojo.byId("toBeReplaced").innerHTML = response;
      
      		//Dojo recommends that you always return(response); to propagate 
      		//the response to other callback handlers. Otherwise, the error 
      		//callbacks may be called in the success case.
      		return response;
   		},
    	error: function(response){
      		dojo.byId("toBeReplaced").innerHTML = "An error occurred, with response: " + response;
      		return response;
    	},
    
    	//Setting the 'form' parameter to the ID of a form on the page
    	//submits that form to the specified URL
    	form:"myForm"
 	});
}
</script>

<h1>Showing of stuff</h1>

<div id="toBeReplaced">
  This text should be replaced by the text read from 
  the remote file 
  <b>featureexplorer/Dojo/remoteTextFile.html</b> 
  when you click the button.
</div>

<div style='border: 1px solid black; padding: 10px; margin: 5px;'>
	Add something:
	<form id='myForm'>
		<input type="text" name='name' id='name'> 
		<input type="button" name='submit' value='Click it' onclick='getText()'>
	</form>
</div>

<div>
	
<?php foreach($this->stuff as $stuff) : ?>

	<div style='width: 300px; border: 1px solid black; padding: 10px; margin: 5px;'> 
	<?= $stuff->name ?> 
	</div>

<? endforeach; ?>

</div>